﻿Imports System.Data.SqlClient

Public Class CreateEmployee
    Inherits System.Web.UI.Page


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub backButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles backButton.Click
        Response.Redirect("ManageEmployee.aspx")
    End Sub

    Protected Sub createButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles createButton.Click

        Roles.AddUserToRole(Membership.CreateUser(createUserNameBox.Text, createUserPasswordBox.Text, userEmailBox.Text).UserName, "Employee")

        Dim userid As New Parameter
        userid.Name = "userid"
        userid.DefaultValue = Membership.GetUser(createUserNameBox.Text).ProviderUserKey.ToString

        SqlDataSource1.InsertParameters.Add(userid)

        SqlDataSource1.Insert()



    End Sub
End Class